﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><!--{$system.sitename}-->后台管理登陆</title>
<link href="view/admin/public/css/mobile.css" rel="stylesheet" media="screen and(max-device-width:480px)"/>
<link href="view/admin/public/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<link href="view/admin/public/css/login.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="static/js/jquery/jquery-1.8.2.min.js"></script>
<script src="view/admin/public/js/jquery.form.js"></script>
<script src="view/admin/public/js/bootstrap-modal.js"></script>

<!--全局js-->
<link href="static/js/lhgdialog/skins/idialog.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="static/js/lhgdialog/lhgdialog.min.js?skin=idialog"></script>
<script type="text/javascript">
$(document).ready(function(){
	$(".verification").hover(function() {
	 	$(".ver_code_pop").show();
	});

	$(".verification").focus(function() {
	 	$(".ver_code_pop").show();
	});
	//回车登陆
	$(document).keyup(function(event) {
        var keycode = event.which;
        if (keycode == 13) {
			login();
        }
    });

});

function refreshCode(){
	var timenow = new Date().getTime();
	document.getElementById('verifyImg').src = "<!--{U str='admin/public/captcha' }-->"+'?'+timenow;
}

function login(){
	$.ajax({
	  type: 'POST',
	  url: "<!--{U str='admin/public/checklogin'}-->",
	  data:{username: $('#username').attr('value'),password: $('#password').attr('value'),verify: $('#verify').attr('value')},
	  dataType: "json",
	  success:function(data){
			if(data.result){
				//alert(reslut.tip);
				window.location.href="<!--{U str='admin/index/index'}-->"; 
			}else{
				$.dialog.alert(data.data.reason);
			}
		}
	  });
}

function textReset(){
	document.getElementById('username').value = "";
	document.getElementById('password').value = "";
	document.getElementById('verify').value = "";
	document.getElementById('error_span').innerHTML = "";
	refreshCode();
}

</script>
</head>
<body>
<div class="header">
  <div class="login_logo"><h1><!--{$system.sitename}--> 登陆</h1></div>
</div>
<div class="fast_track">
  <div class="fast_track_nav">
    <div class="aimee_blue"><span class="hide"><i class="icon-wrench icon-white"></i></span></div>
    <div class="aimee_orange"><span class="hide"><i class="icon-user icon-white"></i></span></div>
    <div class="aimee_red"><span class="hide"><i class="icon-envelope icon-white"></i>3</span></div>
  </div>
</div>
<div class="aimee_login">
  <form>
    <div class="login_input_box">
      <input class="username" name="username" id="username" type="text"/>
      <input class="password" name="password" id="password" type="password"/>
      <div class="ver_code">
        <div class="ver_code_pop">
        <img src="<!--{U str='admin/public/captcha'}-->" alt="" id="verifyImg" >
        <span class="refresh_code" onclick="refreshCode();"></span></div>
        <input name="verify" id="verify" class="verification" type="text" />
      </div>
    </div>
    <div class="login_input">
      <button type="button" class="btn btn-inverse" onclick="login();">登陆</button>
      <button type="button" class="btn btn-inverse" onclick="textReset();">重置</button>
    </div>
  </form>
</div>
</body>
</html>
